|
|
|
|
|
|
|
This gives you a way to calculate the distance from the point to the line. For example, consider the point and line in Figure 19.7. |
|
|
|
|
|
|
|
|
C = (1, 1), P = (1, 3), and V = <2, 2>. Then A = P C = <1 1, 3 1> = <0, 2>. Plugging these values into the previous equation gives: |
|
|
|
 |
|
|
|
|
|A - A'| = Sqr(|A|2 - ((A · V)/|V|)2)
= Sqr(4 - ((0 * 2 + 2 * 2)/Sqr(8))2)
= Sqr(4 - 2)
= Sqr(2) |
|
|
|
|
|
|
|
|
This agrees with Figure 19.7. |
|
|
|
|
|
|
|
|
Suppose C is a point on a plane with normal vector N and P is a point not on the plane. Let A be the vector from point C to point P. Then the shortest distance from point P to the plane is along A', the projection of vector A onto vector N as shown in Figure 19.8. |
|
|
|
|
|
|
|
|
The section Projection of a Vector onto a Vector earlier in this chapter showed that: |
|
|
|
 |
|
|
|
|
|A'| = (A N)/|N| |
|
|
|
|
|
|
|
|
For a simple example, let P = (0, 2, 0), C = (0, 0, 0), and let the normal vector N = <0, 1, 0>. Then A = <0, 2, 0> so: |
|
|
|
 |
|
|
|
|
|A'| = (0 * 0 + 2 * 1 + 0 * 0)/1
= 2/1
= 2 |
|
|
|
|
|
|
|
|
Figure 19.7
Finding the shortest distance between a point and a line. |
|
|
|
|
|